﻿using System;
using System.Collections.Generic;
using System.Text;
using ContentRenderingApi.Extender;
using ContentRenderingApi.Skeleton;

namespace ContentRenderingApi.Data.Comparer
{
    /// <summary/>
    internal class SortComparer : IComparer<AbstractData>
    {
        private SortSkeleton _sortSkeleton;
        private SortComparer _successor;

        /// <summary/>
        internal SortComparer(SortSkeleton sortSkeleton)
        {
            this._sortSkeleton = sortSkeleton;
        }

        /// <summary/>
        internal SortComparer Successor
        {
            set { this._successor = value; }
        }

        /// <summary/>
        public int Compare(AbstractData dataOne, AbstractData dataTwo)
        {
            return this._sortSkeleton.Compare(new NodeExtender(dataOne), new NodeExtender(dataTwo));
        }
    }
}
